package com.jkl.comm.filter;

import org.springframework.core.annotation.Order;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.IOException;
import java.util.Map;

/**
 * @author liuzhennan
 * @create 2021-03-30 15:03
 */

@Order(1)
@WebFilter(urlPatterns = { "/jky" })
public class HomeFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest request1 = (HttpServletRequest) request;

        HttpServletRequestWrapper httpServletRequestWrapper = new HttpServletRequestWrapper((HttpServletRequest) request);
        httpServletRequestWrapper.getParameter("token");
        Map<String, String[]> map = httpServletRequestWrapper.getParameterMap();
        System.out.println(request);
    }

    @Override
    public void destroy() {

    }
}
